import Vue from "vue";
import Router from "vue-router";
const _import = require("./_import_" + process.env.NODE_ENV);
// in development env not use Lazy Loading,because Lazy Loading too many pages will cause webpack hot update too slow.so only in production use Lazy Loading
Vue.use(Router);

/* layout */
import Layout from "../views/layout/Layout";

/**
 * icon : the icon show in the sidebar
 * hidden : if `hidden:true` will not show in the sidebar
 * redirect : if `redirect:noredirect` will no redirct in the levelbar
 * noDropdown : if `noDropdown:true` will has no submenu
 * meta : { role: ['admin'] }  will control the page role
 **/
export const constantRouterMap = [
  {
    path: "/",
    component: Layout,
    redirect: "/pages/bigDatacyy/selfQuotient",
    name: "首页",
    meta: {
      role: [
        "admin",
        "zhdMWKJ",
        "zhdDC",
        "zhdFlh",
        "zhdJK",
        "zhdCYY",
        "zhdRM",
        "zhdXZ",
        "zhdXRXBB",
        "zhdSJFWB",
        "zhdCWB"
      ]
    },
    hidden: true
  }
];

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRouterMap
});
// const ss = {
//   path: "/pages/bigDatacyy",
//   redirect: "/pages/bigDatacyy/cyy",
//   name: "首页",
//   children: [{
//     path: "selfQuotient",
//     icon: "round",
//     component: "pages/bigData3/cyy/selfQuotient",
//     name: "内贸电商数据看板"
//   }, {
//     path: "cloudStorehouse",
//     icon: "round",
//     component: "pages/bigData3/cyy/cloudStorehouse",
//     name: "云仓数据看板"
//   }]
// }
export const asyncRouterMap = [
  {
    path: "/pages/bigDatacyy",
    component: Layout,
    name: "产业园经营数据",
    icon: "zonghe",
    meta: {
      role: ["admin", "zhdCYY"]
    },
    children: [
      {
        path: "selfQuotient",
        icon: "round",
        component: _import("pages/bigData3/cyy/selfQuotient"),
        name: "内贸电商数据看板",
        meta: {
          role: ["admin", "zhdCYY"]
        }
      },
      {
        path: "cloudStorehouse",
        icon: "round",
        component: _import("pages/bigData3/cyy/cloudStorehouse"),
        name: "云仓数据看板",
        meta: {
          role: ["admin", "zhdCYY"]
        }
      },
      {
        path: "bestrideAreaShop",
        icon: "round",
        component: _import("pages/bigData3/cyy/bestrideAreaShop"),
        name: "跨境电商数据看板",
        meta: {
          role: ["admin", "zhdCYY"]
        }
      },
      {
        path: "express",
        icon: "round",
        component: _import("pages/bigData3/cyy/express"),
        name: "浩德速运数据看板",
        meta: {
          role: ["admin", "zhdCYY"]
        }
      },
      {
        path: "researchInstitute",
        icon: "round",
        component: _import("pages/bigData3/cyy/researchInstitute"),
        name: "电子商务产业园看板",
        meta: {
          role: ["admin", "zhdCYY"]
        }
      }
    ]
  },
  {
    path: "/errlog",
    component: Layout,
    redirect: "noredirect",
    name: "errlog",
    icon: "bug",
    hidden: true,
    noDropdown: true,
    children: [
      {
        path: "log",
        component: _import("errlog/index"),
        name: "错误日志"
      }
    ]
  },
  {
    path: "*",
    hidden: true,
    component: _import("errorPage/404")
  }
];
